<nav  class="app-header navbar navbar-expand bg-body" th:fragment="header"> <!--begin::Container-->
    <div class="container-fluid"> <!--begin::Start Navbar-->
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-lte-toggle="sidebar" href="#" role="button">
                    <i class="bi bi-list"></i>
                </a>
            </li>
            <li class="nav-item d-none d-md-block"><a href="#" class="nav-link">首页仪表盘</a></li>
            <li class="nav-item d-none d-md-block"><a href="#" class="nav-link">订单</a></li>
        </ul> <!--end::Start Navbar Links--> <!--begin::End Navbar Links-->
        <ul class="navbar-nav ms-auto"> <!--begin::Navbar Search-->
            <li class="nav-item">
                <a class="nav-link" data-widget="navbar-search" href="#" role="button">
                    <i class="bi bi-search"></i>
                </a>
            </li> <!--end::Navbar Search-->
            <!--begin::Fullscreen Toggle-->
            <li class="nav-item">
                <a class="nav-link" href="#" data-lte-toggle="fullscreen">
                    <i data-lte-icon="maximize" class="bi bi-arrows-fullscreen"></i>
                    <i data-lte-icon="minimize" class="bi bi-fullscreen-exit" style="display: none;"></i>
                </a>
            </li> <!--end::Fullscreen Toggle--> <!--begin::User Menu Dropdown-->
            <li class="nav-item dropdown user-menu">
                <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown">
                    <img src="/assets/img/default_avatar.jpg" class="user-image rounded-circle shadow" alt="User Image">

                    <span class="d-none d-md-inline" th:if="${session.admin != null}" th:text="${session.admin.name}">Admin</span>

                </a>
                <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-end"> <!--begin::User Image-->
                    <li class="user-header text-bg-primary">
                        <img src="/assets/img/default_avatar.jpg"
                             class="rounded-circle shadow" alt="User Image">
                        <p>
                            <span th:if="${session.admin != null}" th:text="${session.admin.name}">zzl</span>
                            <small>管理员</small>
                        </p>
                    </li>
                    <li class="user-footer">
                        <a href="#" class="btn btn-default btn-flat">详细信息</a>
                        <a href="javascript:void(0)" onclick="logout()"
                           class="btn btn-default btn-flat float-end">安全退出</a></li> <!--end::Menu Footer-->
                </ul>
            </li> <!--end::User Menu Dropdown-->
        </ul> <!--end::End Navbar Links-->
    </div> <!--end::Container-->
    <script>
        function logout() {
            axios.post("/api/admin/logout").then(res => {

                    if (res.data === "ok") {
                        window.location.href="/admin/login"
                    }
                }
            )
        }
    </script>
</nav>
